package org.song.model.entity;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import java.util.Date;

@ApiModel("用户操作记录实体")
@Table(name = "`user_blog_operate`")
@Data
public class UserBlogOperateEntity {
    /**
     * 主键
     */
    @Id
    @Column(name = "`id`")
    @ApiModelProperty("主键")
    private Long id;

    /**
     * 用户Id
     */
    @Column(name = "`user_id`")
    @ApiModelProperty("用户Id")
    private String userId;

    /**
     * 博客Id
     */
    @Column(name = "`blog_id`")
    @ApiModelProperty("博客Id")
    private Long blogId;

    /**
     * 用户操作类型：0：点击博客 1：评论博客  2：点赞博客 3：收藏博客
     */
    @Column(name = "`operate_type`")
    @ApiModelProperty("用户操作类型：0：点击博客 1：评论博客  2：点赞博客 3：收藏博客")
    private Byte operateType;

    /**
     * 删除：0：未删除 1：已删除
     */
    @Column(name = "`deleted`")
    @ApiModelProperty("删除：0：未删除 1：已删除")
    private Byte deleted;

    /**
     * 创建时间
     */
    @Column(name = "`create_time`")
    @ApiModelProperty("创建时间")
    private Date createTime;

    /**
     * 修改时间
     */
    @Column(name = "`modify_time`")
    @ApiModelProperty("修改时间")
    private Date modifyTime;


    /**
     * 用户博客操作枚举
     */
    public enum UserBlogOperateEnum {
        CLICK( (byte) 0 , "CLICK"),
        COMMENT( (byte) 1 , "COMMENT"),
        THUMB( (byte) 2 , "THUMB"),
        COLLECT( (byte) 3 , "COLLECT"),
        APPRECIATE( (byte) 4 , "APPRECIATE")
        ;
        private Byte code;
        private String msg;

        UserBlogOperateEnum(Byte code, String msg) {
            this.code = code;
            this.msg = msg;
        }

        public Byte getCode() {
            return code;
        }

        public String getMsg() {
            return msg;
        }
    }

}
